﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Classes;
using FlightSystemDBLayer;


namespace FlightSystemControlLayer
{
    class SearcherCtr
    {
        IList<City> listOfCities;
        IList<Flight> listOfFlights;
        City cityFrom;
        City cityTo;
        int seatsNo;
        DateTime departureTime;
        DateTime arrivalTime;
        ICity dbCity;
        Searcher searcher;
        IFlight dbFlight;

        public SearcherCtr()
        {
            dbCity = new DBCity();
            dbFlight = new DBFlight();
        }
        public void MakeASearch(string cityFromName, string cityToName)
        {
             searcher = new Searcher();
            cityFrom = dbCity.FindCityByName(cityFromName);
            cityTo = dbCity.FindCityByName(cityToName);
            listOfCities = dbCity.GetDBCities();
            listOfFlights = dbFlight.GetFlights();
            searcher.MakeAGraph(listOfCities, listOfFlights);
            searcher.MakeASearchInGraph(cityFrom, cityTo);
        }
    }
}
